package com.sisyphus.spinach.network.views;

import android.widget.TextView;

import com.sisyphus.spinach.core.INetTask;

/**
 * 按键触发请求后，显示加载中的提示信息
 */
public class SisyphusButton<T> extends Debounce<T> {

    private final TextView textView;

    private final CharSequence hintText, originText;

    public SisyphusButton(TextView textView, CharSequence hintText, INetTask.View<T> taskView) {
        super(textView, taskView);
        this.textView = textView;
        this.hintText = hintText;
        this.originText = textView.getText();
    }

    @Override
    public void start() {
        super.start();
        textView.setText(hintText);
    }

    @Override
    public void complete() {
        super.complete();
        textView.setText(originText);
    }

}
